package exia.java.core.entities;

import java.io.Serializable;

import exia.java.core.entities.base.BaseUtilisateur;

/**
 * 
 * @author Jeannette Sebastien
 *
 */
public class Utilisateur extends BaseUtilisateur implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int id;
	private String type;
	private String nom;
	private String prenom;
	private String adresse;
	private String tel;
	private String login;
	private String password;
	private int nbConnections;
	private Byte connected;
	
	/**
	 * 
	 */
	public Utilisateur(){
		super();
	}

	/**
	 * 
	 * @param id
	 * @param type
	 * @param nom
	 * @param prenom
	 * @param adresse
	 * @param tel
	 * @param login
	 * @param password
	 * @param nbConnections
	 * @param connected
	 */
	public Utilisateur(final int id, final String type, final String nom, final String prenom, final String adresse, final String tel, final String login, final String password, final int nbConnections, final boolean connected){
		super();
		this.id = id;
		this.type = type;
		this.nom = nom;
		this.prenom = prenom;
		this.adresse = adresse;
		this.tel = tel;
		this.login = login;
		this.password = password;
		this.nbConnections = nbConnections;
		if(connected == true){
			this.connected = 1;
		}else{
			this.connected = 0;
		}
	}
	
	/**
	 * 
	 * @return
	 */
	public int getId() {
		return this.id = super.getIdUser();
	}

	/**
	 * 
	 * @param id
	 */
	public void setId(int id) {
		this.id = id;
		super.setIdUser(this.id);
	}

	/**
	 * 
	 * @return
	 */
	public String getType() {
		return super.getUserType();
	}

	/**
	 * 
	 * @param type
	 */
	public void setType(final String type) {
		this.type = type;
		super.setUserType(this.type);
	}

	/**
	 * 
	 * @return
	 */
	public String getNom() {
		return this.nom = super.getNom();
	}

	/**
	 * 
	 * @param nom
	 */
	public void setNom(final String nom) {
		this.nom = nom;
		super.setNom(this.nom);
	}

	/**
	 * 
	 * @return
	 */
	public String getPrenom() {
		return prenom;
	}

	/**
	 * 
	 * @param prenom
	 */
	public void setPrenom(final String prenom) {
		this.prenom = prenom;
	}

	/**
	 * 
	 * @return
	 */
	public String getAdresse() {
		return adresse;
	}

	/**
	 * 
	 * @param adresse
	 */
	public void setAdresse(final String adresse) {
		this.adresse = adresse;
	}

	/**
	 * 
	 * @return
	 */
	public String getTel() {
		return tel;
	}

	/**
	 * 
	 * @param tel
	 */
	public void setTel(final String tel) {
		this.tel = tel;
	}

	/**
	 * 
	 * @return
	 */
	public String getLogin() {
		return login;
	}

	/**
	 * 
	 * @param login
	 */
	public void setLogin(final String login) {
		this.login = login;
	}

	/**
	 * 
	 * @return
	 */
	public String getPassword() {
		return this.password = super.getPass();
	}

	/**
	 * 
	 * @param password
	 */
	public void setPassword(final String password) {
		this.password = password;
		super.setPass(this.password);
	}

	/**
	 * 
	 * @return
	 */
	public int getNbConnections() {
		return this.nbConnections = super.getNbCon();
	}

	/**
	 * 
	 * @param nbConnections
	 */
	public void setNbConnections(final int nbConnections) {
		this.nbConnections = nbConnections;
		super.setNbCon(this.nbConnections);
	}

	/**
	 * 
	 * @return
	 */
	public boolean isConnected() {
		boolean conn = false;
		this.connected = super.getConnecte();
		if(this.connected == 1){
			conn = true;
		}
		return conn;
	}

	/**
	 * 
	 * @param connected
	 */
	public void setConnected(boolean connected) {
		if(connected == true){
			this.connected = 1;
			super.setConnecte(this.connected);
		}else{
			this.connected = 0;
			super.setConnecte(this.connected);
		}
	}
	
}
